﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using protoNet;
using VitServer;

public class Announce : MonoBehaviour
{
    [SerializeField] private Text text;
    [SerializeField] private GameObject board_login;

    void Start()
    {
        _G.CreateLogFile();

        MsgReader.OnMessageRecieved(GAME_PROTOCOL_MSG_ID.ID_S2C_NOTICE, OnGetNotice);

        MsgSender.SendID_C2S_NOTICE();

    }

    void Update()
    {

    }

    private void OnGetNotice(object message)
    {
        string notice = ((MsgNoticeRep)message).notice;
        _G.Print("Got Notice: " + notice);
        text.text = notice;
    }

    public void OnCloseAnnounce()
    {
        gameObject.SetActive(false);
        board_login.SetActive(true);
    }
}
